package Thread;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class MyScheduledTask implements Runnable {
    @Override
    public void run() {
        System.out.println("hello run");
    }

    public static void main(String[] args) {
        ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
        MyScheduledTask task = new MyScheduledTask();

        scheduler.scheduleAtFixedRate(task, 1, 2, TimeUnit.SECONDS);
        System.out.println("hello main");
    }
}
